#ifndef __EEDIT_MEM_M__
#define __EEDIT_MEM_M__

#include <stdio.h>


#define DEBUG_CHECK_BOUNDS(a,b) if(a<b){\
    printf("##DEBUG_CHECK_BOUNDS failed %i < %i in %s",\
            a,b,__PRETTY_FUNCTION__);\
}

#define DEBUG_FATAL(a) {\
    printf("##  Fatal Message: %s\n##    From: %s\n\n",\
            a,__PRETTY_FUNCTION__);\
    exit(1);\
}

#define DEBUG_WARN(a) {\
    printf("##  Warn Message: %s\n##    From: %s\n\n",\
            a,__PRETTY_FUNCTION__);\
}

#define DEBUG_INFO(a) {\
    printf("##  Info Message: %s\n##    From: %s\n\n",\
            a,__PRETTY_FUNCTION__);\
}

#if 0
#define DEBUG_LOC() printf("##  Function Called: %s\n",__PRETTY_FUNCTION__);
#else
#define DEBUG_LOC()
#endif

#define END_CHECK(line,buffer) {\
    if(line->next==NULL){\
        assert(line==buffer->tail);\
        return 0;\
    }else{\
        return 1;\
    }\
}

/*
 * a  - chunk->length
 * b  - chunk->length_sans_newline
 * c  - character
 */
#define INCREMENT_LENGTH(a,b,c)\
    if(a==CHUNK_SIZE) DEBUG_WARN("Incrementing over CHUNK_SIZE ... BAD!");\
    if(c=='\n'){\
        a++;\
    }else{\
        a++;\
        b++;\
    }

#define DECREMENT_LENGTH(a,b,c)\
    if(c=='\n'){\
        a--;\
    }else{\
        a--;\
        b--;\
    }


#endif /* End Macro Header */
